package com.example.a313ldy.yuejian_17.Activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.a313ldy.yuejian_17.Fragment.IndexFragment.MasterFragment.MasterCrouseFragment;
import com.example.a313ldy.yuejian_17.Fragment.IndexFragment.MasterFragment.MasterResponseFragment;
import com.example.a313ldy.yuejian_17.R;
import com.squareup.picasso.Picasso;

/**
 * Created by LDY on 2017/10/24.
 */

public class Master_detail extends AppCompatActivity{
    private ImageView master_pic;
    private TextView master_intro;
    private TextView address;
    private TextView master_name;
    private Button master_course;
    private Button master_response;
    private ImageButton back;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.master_detail);
        initView();
    }
    private  void initView(){
        Intent intent = getIntent();
        master_pic = (ImageView)findViewById(R.id.act_pic);
        Picasso.with(this).load(intent.getStringExtra("img")).into(master_pic);

        master_name =(TextView)findViewById(R.id.master_name);
        master_name.setText(intent.getStringExtra("master_name"));

        master_intro =(TextView)findViewById(R.id.act_intro);
        master_intro.setText(intent.getStringExtra("intro"));

        /*address =(TextView)findViewById(R.id.adress);
        address.setText(intent.getStringExtra("address"));*/


        /*price = intent.getStringExtra("act_price");
        name = intent.getStringExtra("act_name");
        pic = intent.getStringExtra("img");
        num = intent.getStringExtra("act_num");
        pay_time = intent.getStringExtra("pay_time");*/


        master_course = (Button)findViewById(R.id.master_course);
        master_course.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(Master_detail.this,MasterCrouseFragment.class);
                /*intent.putExtra("act_price",price);
                intent.putExtra("name",name);*/
                startFragment(intent);
            }
        });

        master_response = (Button)findViewById(R.id.master_response);
        master_response.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(Master_detail.this,MasterResponseFragment.class);
                /*intent.putExtra("act_price",price);
                intent.putExtra("name",name);*/
                startFragment(intent);
            }
        });

        back = (ImageButton)findViewById(R.id.back);
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent =  new Intent(Master_detail.this,MainActivity.class);
                //startActivity(intent);
                onBackPressed();
            }
        });

    }

    private void startFragment(Intent intent) {

    }

}

